package com.framework.modules.base.dao;

import com.framework.modules.base.entity.PostsCommentsEntity;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

/**
 * 用户评论
 * 
 * @author MIT
 * @email litmiss@gmail.com
 * @date 2020-10-03 16:58:28
 */
public interface PostsCommentsDao extends BaseMapper<PostsCommentsEntity> {
    /**
     * 更新评论喜欢数
     * @return
     */
    @Update("update tb_posts_comments set like_count=#{likeCount} where id=#{id}")
    Integer updateCommentLikeCount(@Param("id") Integer id, @Param("likeCount")Integer likeCount);

    /**
     * 更新评论喜欢数+1
     * @return
     */
    @Update("update tb_posts_comments set like_count=like_count+1 where id=#{id}")
    Integer addCommentLikeCount(@Param("id")Integer id);

    /**
     * 更新评论喜欢数-1
     * @return
     */
    @Update("update tb_posts_comments set like_count=like_count-1 where id=#{id}")
    Integer reduceCommentLikeCount(@Param("id")Integer id);

}
